<template>
	<view class="jsOrder">
		<view class="fixed-box" v-show="headOpacity==0" >
			<view class="sys-head" view :style="{ height: statusBarHeight+'px' }"></view>
			<view class="header-title">
				<view class="head-wrapper" :style="'top:'+statusBarHeight+'px'">
					<view class="head-menu">
						<view class='iconfont icon-xiangzuo' @click="returns"></view>
					</view>
				</view>
				结算订单
			</view>
		</view>
		<view class="fixed-box" :style="'opacity:'+headOpacity" style="background-color: #fff;">
			<view class="sys-head" view :style="{ height: statusBarHeight+'px' }"></view>
			<view class="header-title" style="color: #333;">
				<view class="head-wrapper" :style="'top:'+statusBarHeight+'px'">
					<view class="head-menu">
						<view class='iconfont icon-xiangzuo' style="color: #333;" @click="returns"></view>
					</view>
				</view>
				结算订单
			</view>
		</view>
		<view class="bgBox"></view>
		<view class="content-box" :style="'top:'+(43+statusBarHeight)+'px'" >
			<view class="flex-between-center orderNum">
				<view >
					<view>{{settleNum}}</view>
					<view>结算订单数量</view>
				</view>
				<view class="line"></view>
				<view>
					<view>{{totalSettelPoint}}</view>
					<view>累计结算积分</view>
				</view>
			</view>
			<view class="list">
				<view class="item" v-for="(item,index) in orderList" :key="index" >
					<view class="flex-between-center top">
						<view class="orderId">订单编号：{{item.orderNo}}</view>
						<view class="status">{{item.isJs==0?'未结算':'已结算'}}</view>
					</view>
					<view class="flex-align-center bottom">
						<view class="left flex-aj-center">
							<image src="@/static/images/circle.png" class="circle" mode=""></image>
							<view class="line"></view>
							<image src="@/static/images/circle.png" class="circle" mode=""></image>
						</view>
						<view class="right" style="width: 100%;" >
							<view class="flex-between-center" style="margin-bottom: 48rpx;width: 100%;" >
								<view class="name">客户姓名：<text>{{item.name}}</text> </view>
								<view class="grade">结算积分：{{item.jsPoint}}</view>
							</view>
							<view class="phone">联系电话：<text>{{item.phone}}</text> </view>
						</view>
					</view>
				</view>
				<view class="flex-aj-center" style="margin-top: 200rpx;" v-if="orderList.length==0" >
					<image src="../../static/images/no-data.png" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getTopData,
		getOrderList
	} from "@/api/user.js"
	export default {
		data(){
			return{
				statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
				headOpacity: 0,
				settleNum:0,
				totalSettelPoint:0,
				orderList:[],
				pageNum:1
			}
		},
		onPageScroll(e) {
			let scrollY = e.scrollTop;
			let height = this.statusBarHeight + 43
			var opacity = (scrollY / height);
			this.headOpacity = opacity > 1 ? 1 : opacity;
		},
		onLoad() {
			this.getTopData()
			this.getOrderList()
		},
		methods:{
			getTopData(){
				getTopData().then(res=>{
					this.settleNum = res.data.settleNum
					this.totalSettelPoint = res.data.totalSettelPoint
				})
			},
			getOrderList() {
				getOrderList({
					pageNum:this.pageNum,
					pageSize:10,
					status:5
				}).then(res=>{
					if(this.pageNum==1){
						this.orderList = res.data.records
					}else{
						this.orderList = this.orderList.concat(res.data.records)
					}
					if(this.orderList.length==res.data.total){
						
					}else{
						this.pageNum++
					}
				})
			},
			returns(){
				uni.navigateBack()
			},
			goPage(url){
				uni.navigateTo({
					url
				})
			}
		},
		onReachBottom() {
			this.getOrderList()
		}
	}
</script>

<style lang="scss" scoped >
	.content-box{
		position: relative;
		padding: 0 24rpx;
		.orderNum{
			padding: 48rpx 0;
			>view{
				width: 326rpx;
				text-align: center;
				:first-child{
					font-family: D-DINExp;
					font-weight: bold;
					font-size: 48rpx;
					color: #FFFFFF;
					line-height: 48rpx;
					text-align: center;
					font-style: normal;
					margin-bottom: 16rpx;
				}
				:last-child{
					height: 24rpx;
					font-family: PingFangSC;
					font-weight: 400;
					font-size: 24rpx;
					color: rgba(255,255,255,0.72);
					line-height: 24rpx;
					text-align: center;
					font-style: normal;
				}
			}
			.line{
				width: 2rpx;
				height: 56rpx;
				background: rgba(255,255,255,0.24);
			}
		}
	}
	
	.list{
		padding: 0 24rpx;
		.item{
			margin-top: 24rpx;
			background: #FFFFFF;
			border-radius: 16rpx;
			.top{
				width: 100%;
				height: 96rpx;
				background: #FAFAFA;
				border-radius: 16rpx 16rpx 0rpx 0rpx;
				border: 2rpx solid #FFFFFF;
				padding: 0 24rpx;
				.orderId{
					font-family: PingFangSC;
					font-weight: 500;
					font-size: 32rpx;
					color: #292929;
					line-height: 32rpx;
					text-align: left;
					font-style: normal;
				}
				.status{
					font-family: PingFangSC;
					font-weight: 500;
					font-size: 28rpx;
					color: #08CC7E;
					line-height: 28rpx;
					text-align: left;
					font-style: normal;
				}
			}
			.bottom{
				padding: 48rpx 24rpx;
				.left{
					flex-direction: column;
					margin-right: 16rpx;
					.circle{
						width: 28rpx;
						height: 28rpx;
					}
					.line{
						width: 2rpx;
						height: 48rpx;
						border: 2rpx solid #EBEBEB;
					}
				}
				.right{
					.name,.phone{
						font-family: PingFangSC;
						font-weight: 400;
						font-size: 28rpx;
						color: #666666;
						line-height: 28rpx;
						text-align: left;
						font-style: normal;
						text{
							color: #292929;
						}
					}
					.grade{
						height: 28rpx;
						font-family: PingFangSC;
						font-weight: 400;
						font-size: 28rpx;
						color: #FF3729;
						line-height: 28rpx;
						text-align: right;
						font-style: normal;
					}
				}
			}
		}
	}
	
	.bgBox{
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 360rpx;
		background: linear-gradient( 90deg, #FF961F 0%, #FF781F 100%);
	}
	
	.fixed-box {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		z-index: 99;
	
		.header-title {
			height: 43px;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #fff;
	
			.head-wrapper {
				z-index: 999;
				display: flex;
				align-items: center;
				position: fixed;
				left: 30rpx;
				top: 0;
				/* #ifdef MP */
				height: 43px;
				/* #endif */
				/* #ifdef H5 */
				height: 114rpx;
	
				/* #endif */
				.head-menu {
					display: flex;
					align-items: center;
					height: 54rpx;
					border-radius: 27rpx;
	
					.iconfont {
						flex: 1;
						text-align: left;
						color: #fff;
						box-sizing: border-box;
					}
				}
			}
	
		}
	}
</style>